home *** CD-ROM | disk | FTP | other *** search
- /*****************************************************************************/
- /* SGMLAPIR: SGML API for REXX */
- /* Author: Roy Engehausen */
- /* Mods: Jack Steitz 1. Bring code to ANSI standard */
- /* Mods: Charles F. Goldfarb 2. Convert to Borland C */
- /* */
- /******************************************************************************/
- /* Secret public variable for use by markup validator (not in SGMLAPI.H). */
- int TPisVM = 0; /* Set to 1 by TP if it is markup validator. */
- /*****************************************************************************/
-
- /*===========================================================================*/
- /* External files */
- /*===========================================================================*/
-
- #include "sgmlapi.h" /* Text processor header for SGML interfacing. */
- #include "vmincl.h" /* Include files for VM. */
- #include "vmxtrn.h" /* Declarations for VM public variables. */
-
- /*---------------------------------------------------------------------------*/
- /* Global structures */
- /*---------------------------------------------------------------------------*/
-
- struct rcbde de = {0}; /* RCB for current data entity information. */
- struct rcbte te = {0}; /* RCB for calls to SGMLAPI (TP+ENV). */
- UNCH sgmlomsg[] = /* Text for invalid option error message. */
- "/d /e /f /g /mSGML.MSG /p1 /r /t3";
- /*===========================================================================*/
- /* Subroutine forwards */
- /*===========================================================================*/
-
- static void rexx_attr(int, char*); /* Put attribute list into rexx */
- void alset(struct ad *); /* Set up to start processing att list. */
- void setndata(PNE); /* Build ext data entity rcbde with entity text.*/
- static void rexx_set(char *, char *, int);
- static void rexx_drop(char *);
-
- /*===========================================================================*/
- /* Global variables */
- /*===========================================================================*/
-
- int tag_stack;
- int drop_pending;
- char drop_me[30];
- char alist[200];
-
- /*===========================================================================*/
- /* Main routine */
- /*===========================================================================*/
-
- void sgmlapir(int argc, char **argv)
- {
-
- /*-----------------------------------------------------------------------*/
- /* Local variables */
- /*-----------------------------------------------------------------------*/
-
- char buffer[10];
- UNCH *fileid = NULL;
- char *funct = NULL;
- int i;
-
- /*-----------------------------------------------------------------------*/
- /* Check parameter count */
- /*-----------------------------------------------------------------------*/
-
- if (argc < 2)
- {
- printf("\nFunction parameter is missing -- %d\n", argc);
- exit(1);
- }
-
- /*-----------------------------------------------------------------------*/
- /* The function name is the first item. */
- /*-----------------------------------------------------------------------*/
-
- funct = argv[1];
-
- /*-----------------------------------------------------------------------*/
- /* Execute proper function */
- /*-----------------------------------------------------------------------*/
-
- /*-----------------------------------------------------------------------*/
- /* NEXT */
- /*-----------------------------------------------------------------------*/
-
- if (strcmp(funct, "NEXT") == 0)
- {
-
- if (drop_pending)
- {
- rexx_drop(drop_me);
- drop_pending = 0;
- }
-
- sgmlnext();
-
- return;
-
- }
-
- /*-----------------------------------------------------------------------*/
- /* INIT */
- /*-----------------------------------------------------------------------*/
-
- if (strcmp(funct, "INIT") == 0)
- {
-
- /*-------------------------------------------------------------------*/
- /* Set the options back to defaults */
- /*-------------------------------------------------------------------*/
-
- drop_pending = 0;
-
- sgmloset();
-
- /*-------------------------------------------------------------------*/
- /* Now loop thru processing the options */
- /*-------------------------------------------------------------------*/
-
- for (i = 1; ++i<argc;)
- {
-
- /*---------------------------------------------------------------*/
- /* It must start with a "/". If not, assume its the file name */
- /*---------------------------------------------------------------*/
-
- if (argv[i][0]!='/')
- fileid = argv[i];
- else
- if (sgmlopt(argv[i])!=0)
- {
- printf("\nTP001-> \"%s\" option switch is"
- " incorrect; usage is: %s", argv[i], sgmlomsg);
- exit(001);
- }
-
- } /*----- End argument process loop -------------------------------*/
-
- /*-------------------------------------------------------------------*/
- /* Check to make sure a fileid is present */
- /*-------------------------------------------------------------------*/
-
- if (fileid==NULL || *fileid=='?')
- {
- printf("\nTP002-> No primary file specified; usage is:"
- " INIT %s [profile;]file", sgmlomsg);
- exit(002);
- }
-
- /*-------------------------------------------------------------------*/
- /* Now process the file name */
- /*-------------------------------------------------------------------*/
-
- if (docent(fileid))
- {
- printf("\nTP005-> SGML document entity system ID"
- " (%s) exceeds 240 characters.", fileid);
- exit(005);
- }
-
- /*-------------------------------------------------------------------*/
- /* Initialize the parser and return */
- /*-------------------------------------------------------------------*/
-
- sgmlset();
-
- /*-------------------------------------------------------------------*/
- /* Initialize the interface */
- /*-------------------------------------------------------------------*/
-
- te.pass = 0;
-
- return;
- }
-
- /*-----------------------------------------------------------------------*/
- /* START_PASS */
- /*-----------------------------------------------------------------------*/
-
- if (strcmp(funct, "START_PASS") == 0)
- {
-
- /*-------------------------------------------------------------------*/
- /* Initialize the interface */
- /*-------------------------------------------------------------------*/
-
- drop_pending = 0;
- tag_stack = 0;
-
- rexx_set("SGML_TAG_LEVEL", "0", 1);
-
- /*-------------------------------------------------------------------*/
- /* Count the pass */
- /*-------------------------------------------------------------------*/
-
- ++te.pass;
-
- /*-------------------------------------------------------------------*/
- /* Tell user */
- /*-------------------------------------------------------------------*/
-
- printf("\nTP105-> Pass %d of %d.", te.pass, te.passes);
-
- /*-------------------------------------------------------------------*/
- /* Initialize the pass */
- /*-------------------------------------------------------------------*/
-
- if (sgmlpset())
- {
- printf("\nTP006-> Could not open SGML document entity in file: %s",
- fileid);
- exit(006);
- }
- return;
- }
-
- /*-----------------------------------------------------------------------*/
- /* END_RUN */
- /*-----------------------------------------------------------------------*/
-
- if (strcmp(funct, "END_RUN") == 0)
- {
-
- i = sgmlend();
-
- sprintf(buffer,"%d", i);
- rexx_set("SGML_DATA", buffer, strlen(buffer));
-
- return;
-
- }
-
- /*-----------------------------------------------------------------------*/
- /* If we reach here, the function code is INVALID */
- /*-----------------------------------------------------------------------*/
-
- printf("\nInvalid function code -- %s\n", funct);
- return;
-
- }
-
- /*===========================================================================*/
- /* SGML NEXT */
- /*===========================================================================*/
-
- int sgmlnext(void)
- {
-
- char buffer[10];
- char composite_name[30];
- char composite_temp1[30];
-
- /*-----------------------------------------------------------------------*/
- /* Main scan loop! */
- /*-----------------------------------------------------------------------*/
-
- do
- {
- /*-----------------------------------------------------------------------*/
- /* Get next item */
- /*-----------------------------------------------------------------------*/
-
- sgml((struct ipbt *)NULL);
- getscbs(SGMLSCBS, SGMLES);
-
- /*-----------------------------------------------------------------------*/
- /* Handle the response */
- /*-----------------------------------------------------------------------*/
-
- switch (RCBTYPE)
- {
-
- /*===================================================================*/
- /* Data found */
- /*===================================================================*/
-
- case SGMLDAF:
-
- /*-----------------------------------------------------------------*/
- /* Set the common data */
- /*-----------------------------------------------------------------*/
-
- te.datalen = CDATALEN;
- te.data = CDATA;
- rexx_set("SGML_DATA", te.data, te.datalen);
-
- /*-----------------------------------------------------------------*/
- /* Regular data */
- /*-----------------------------------------------------------------*/
-
- if (CDESW)
- {
- rexx_set("SGML_EVENT", "CDATA", 4);
- return (TPCDATA);
- }
-
- /*-----------------------------------------------------------------*/
- /* System data */
- /*-----------------------------------------------------------------*/
-
- if (SDESW)
- {
- rexx_set("SGML_EVENT", "SDATA", 5);
- return (TPSDATA);
- }
-
- /*-----------------------------------------------------------------*/
- /* NDATA -- Requires lots of work since it can have its own list */
- /*-----------------------------------------------------------------*/
-
- if (NDESW)
- {
-
- /*-------------------------------------------------------------*/
- /* Set event type */
- /*-------------------------------------------------------------*/
-
- rexx_set("SGML_EVENT", "NDATA", 5);
-
- /*-------------------------------------------------------------*/
- /* Initialize control blocks */
- /*-------------------------------------------------------------*/
-
- setndata(NEPTR);
-
- /*-------------------------------------------------------------*/
- /* Set REXX stuff */
- /*-------------------------------------------------------------*/
-
- rexx_set("SGML_NDATA.ENAME", de.ename, de.enamelen);
- rexx_set("SGML_NDATA.SYSID", de.detxt, de.detxtlen);
- rexx_set("SGML_NDATA.DCNNM", de.dcnnm, de.dcnnmlen);
- rexx_set("SGML_NDATA.NSYS" , de.dcnid, de.dcnidlen);
-
- sprintf(buffer,"%d", de.alcnt);
- rexx_set("SGML_NDATA.ALCNT", buffer, strlen(buffer));
-
- /*-------------------------------------------------------------*/
- /* Build the tag stack name "SGML_NDATA. */
- /*-------------------------------------------------------------*/
-
- strcpy(composite_name, "SGML_NDATA.");
-
- /*-------------------------------------------------------------*/
- /* Set the attributes (if any) */
- /*-------------------------------------------------------------*/
-
- rexx_attr(te.alcnt, composite_name);
-
- /*-------------------------------------------------------------*/
- /* Setup for drop */
- /*-------------------------------------------------------------*/
-
- strcpy(drop_me, "SGML_NDATA.");
- drop_pending = 1;
-
- /*-------------------------------------------------------------*/
- /* Done */
- /*-------------------------------------------------------------*/
-
- return(TPNDATA);
-
- }
-
- /*-----------------------------------------------------------------*/
- /* Non GML character */
- /*-----------------------------------------------------------------*/
-
- if (*te.data==tpsw.delnonch)
- {
- rexx_set("SGML_EVENT", "NON_SGML", 8);
-
- te.data[0] = te.data[1] - tpsw.addnonch;
- te.data[1] = 0;
-
- rexx_set("SGML_DATA", te.data, te.datalen);
-
- return(TPNSGML);
- }
-
- /*-----------------------------------------------------------------*/
- /* Anything left is DATA */
- /*-----------------------------------------------------------------*/
-
- rexx_set("SGML_EVENT", "DATA", 5);
- return(TPPCDATA);
-
- /*===================================================================*/
- /* Start tag found */
- /*===================================================================*/
-
- case SGMLSTG:
-
- /*-----------------------------------------------------------------*/
- /* Set the event type */
- /*-----------------------------------------------------------------*/
-
- rexx_set("SGML_EVENT", "START_TAG", 9);
-
- /*-----------------------------------------------------------------*/
- /* Left over code */
- /*-----------------------------------------------------------------*/
-
- memcpy( &tptags[++tpts][0] , GI, (UNS)*(GI-1) ); /* Stack the GI. */
-
- te.data = GI;
- te.datalen = *(GI-1)-2;
-
- /*-----------------------------------------------------------------*/
- /* Set the data */
- /*-----------------------------------------------------------------*/
-
- rexx_set("SGML_DATA", te.data, te.datalen);
-
- /*-----------------------------------------------------------------*/
- /* Push the tag stack */
- /*-----------------------------------------------------------------*/
-
- ++tag_stack;
-
- /*-----------------------------------------------------------------*/
- /* Tell user what level we are at */
- /*-----------------------------------------------------------------*/
-
- sprintf(buffer,"%d", tag_stack);
- rexx_set("SGML_TAG_LEVEL", buffer, strlen(buffer));
-
- /*-----------------------------------------------------------------*/
- /* Build the tag stack name "SGML_TAG.n. */
- /*-----------------------------------------------------------------*/
-
- strcpy(composite_name, "SGML_TAG.");
- strcat(composite_name, buffer);
- strcat(composite_name, ".");
-
- /*-----------------------------------------------------------------*/
- /* Now set the ".GI" */
- /*-----------------------------------------------------------------*/
-
- strcpy(composite_temp1, composite_name);
- strcat(composite_temp1, "GI");
-
- rexx_set(composite_temp1, te.data, te.datalen);
-
- te.gidata = GIDATA;
- #ifdef V2
- te.format = FORMAT;
- #endif
-
- /*-----------------------------------------------------------------*/
- /* Ready the attribute stuff */
- /*-----------------------------------------------------------------*/
-
- if (ALPTR)
- { /* Tag attributes will be processed. */
- alptr = ALPTR; /* Tag attributes are active att list. */
- te.alcnt = AN; /* Indicate number of attributes in list. */
- te.pca = &te.ca; /* Current attribute structure in rcbte. */
- alset((struct ad *)0); /* Initialize for alnext processing. */
- }
- else
- te.alcnt = 0;
-
- /*-----------------------------------------------------------------*/
- /* Set the attributes (if any) */
- /*-----------------------------------------------------------------*/
-
- rexx_attr(te.alcnt, composite_name);
-
- /*-----------------------------------------------------------------*/
- /* Done with start tag */
- /*-----------------------------------------------------------------*/
-
- return(TPSTAG);
-
- /*===================================================================*/
- /* End tag found */
- /*===================================================================*/
-
- case SGMLETG:
-
- /*-----------------------------------------------------------------*/
- /* Set the event type */
- /*-----------------------------------------------------------------*/
-
- rexx_set("SGML_EVENT", "END_TAG", 7);
-
- /*-----------------------------------------------------------------*/
- /* Left over code */
- /*-----------------------------------------------------------------*/
-
- --tpts; /* Destack the GI. */
- te.data = GI;
- te.datalen = *(GI-1)-2;
- te.gidata = GIDATA;
- #ifdef V2
- te.format = FORMAT;
- #endif
-
- /*-----------------------------------------------------------------*/
- /* Set the data */
- /*-----------------------------------------------------------------*/
-
- rexx_set("SGML_DATA", te.data, te.datalen);
-
- /*-----------------------------------------------------------------*/
- /* Pop the REXX tag stack */
- /*-----------------------------------------------------------------*/
-
- --tag_stack;
-
- /*-----------------------------------------------------------------*/
- /* Tell user what level we are at */
- /*-----------------------------------------------------------------*/
-
- sprintf(buffer,"%d", tag_stack);
- rexx_set("SGML_TAG_LEVEL", buffer, strlen(buffer));
-
- /*-----------------------------------------------------------------*/
- /* Build the tag stack name "SGML_TAG.n. */
- /*-----------------------------------------------------------------*/
-
- strcpy(drop_me, "SGML_TAG.");
- strcat(drop_me, buffer);
- strcat(drop_me, ".");
-
- /*-----------------------------------------------------------------*/
- /* Set drop pending */
- /*-----------------------------------------------------------------*/
-
- drop_pending = 1;
-
- /*-----------------------------------------------------------------*/
- /* Done */
- /*-----------------------------------------------------------------*/
-
- return(TPETAG);
-
- /*===================================================================*/
- /* Processing instruction: string */
- /*===================================================================*/
-
- case SGMLPIS:
-
- rexx_set("SGML_EVENT", "PI", 2);
-
- te.datalen = PDATALEN;
- te.data = PDATA;
-
- rexx_set("SGML_DATA", te.data, te.datalen);
-
- return(PIESW ? TPPIENT : TPPI);
-
- /*===================================================================*/
- /* Record end */
- /*===================================================================*/
-
- case SGMLREF:
-
- rexx_set("SGML_EVENT", "RE", 2);
-
- return(TPRE);
-
- /*===================================================================*/
- /* Document type definition started */
- /* Document type definition ended */
- /* Markup validator info */
- /* These are all ignored */
- /*===================================================================*/
-
- case SGMLSDTD:
- case SGMLEDTD:
- case SGMLMV:
- break; /* Ignore'em */
- /*===================================================================*/
- /* End document */
- /*===================================================================*/
-
- case SGMLEOD:
-
- rexx_set("SGML_EVENT", "EOD", 3);
-
- }
-
- } while (RCBTYPE != SGMLEOD);
- return(TPEOD); /* Avoid lint and TurboC warnings. */
- }
-
- /*===========================================================================*/
- /* REXX_ATTR -- Put an attribute list to REXX */
- /*===========================================================================*/
-
- VOID rexx_attr(int at_counter,
- char *root_name)
- {
-
- char buffer[10];
- char composite_temp[50];
- int composite_reset;
- int end_root;
- int i;
- int j;
- char *blank_me;
-
- end_root = strlen(root_name);
-
- /*-----------------------------------------------------------------------*/
- /* Set the attribute count */
- /*-----------------------------------------------------------------------*/
-
- strcpy(composite_temp, root_name);
- strcat(composite_temp, "ALCNT");
-
- sprintf(buffer,"%d", at_counter);
- rexx_set(composite_temp, buffer, strlen(buffer));
-
- composite_temp[end_root] = '\0';
-
- /*-----------------------------------------------------------------------*/
- /* Clear attribute list */
- /*-----------------------------------------------------------------------*/
-
- alist[0] = '\0';
-
- /*-----------------------------------------------------------------------*/
- /* Attribute loop */
- /*-----------------------------------------------------------------------*/
-
- while (at_counter > 0)
- {
-
- /*-------------------------------------------------------------------*/
- /* Decrement the counter */
- /*-------------------------------------------------------------------*/
-
- --at_counter;
-
- /*-------------------------------------------------------------------*/
- /* Get the attribute data */
- /*-------------------------------------------------------------------*/
-
- alnext();
-
- /*-------------------------------------------------------------------*/
- /* Stick name on the end of the attribute list */
- /*-------------------------------------------------------------------*/
-
- strncat(alist, CA.aname, CA.anamelen);
- strncat(alist, " ", 1);
-
- /*-------------------------------------------------------------------*/
- /* Build the composite name */
- /*-------------------------------------------------------------------*/
-
- composite_temp[end_root] = '\0';
- strncat(composite_temp, CA.aname, CA.anamelen);
-
- /*-------------------------------------------------------------------*/
- /* Save end of the composite name. Makes it easy to clean up */
- /*-------------------------------------------------------------------*/
-
- composite_reset = strlen(composite_temp);
-
- /*-------------------------------------------------------------------*/
- /* Fix up value if a list */
- /*-------------------------------------------------------------------*/
-
- if (CA.atype == TPALIST)
- {
-
- blank_me = CA.aval;
-
- i = CA.avallen;
-
- while (i > 0)
- {
- j = *blank_me + 1;
- *blank_me = ' ';
- blank_me = blank_me + j;
- i = i - j;
- }
-
- ++CA.aval;
- --CA.avallen;
-
- }
-
- /*-------------------------------------------------------------------*/
- /* Set the VALUE */
- /*-------------------------------------------------------------------*/
-
- strcat(composite_temp, ".VALUE");
-
- rexx_set(composite_temp, CA.aval, CA.avallen);
-
- composite_temp[composite_reset] = 0;
-
- /*-------------------------------------------------------------------*/
- /* Set the DATA */
- /*-------------------------------------------------------------------*/
-
- switch(CA.adata)
- {
-
- case TPANOTE:
- strcpy(buffer, "NOTE");
- break;
-
- case TPAENTIT:
- strcpy(buffer, "ENTITY");
- break;
-
- case TPAIDREF:
- strcpy(buffer, "IDREF");
- break;
-
- case TPANONE:
- strcpy(buffer, "NONE");
- break;
-
- default:
- strcpy(buffer, "?");
- break;
-
- }
-
- strcat(composite_temp, ".DATA");
-
- rexx_set(composite_temp, buffer, strlen(buffer));
-
- composite_temp[composite_reset] = '\0';
-
- /*-------------------------------------------------------------------*/
- /* Set the TYPE */
- /*-------------------------------------------------------------------*/
-
- switch(CA.atype)
- {
- case TPACDATA:
- strcpy(buffer, "CDATA");
- break;
-
- case TPATOKEN:
- strcpy(buffer, "TOKEN");
- break;
-
- case TPALIST:
- strcpy(buffer, "LIST");
- break;
-
- default:
- strcpy(buffer, "?");
- break;
-
- }
-
- strcat(composite_temp, ".TYPE");
-
- rexx_set(composite_temp, buffer, strlen(buffer));
-
- composite_temp[composite_reset] = '\0';
-
- /*-------------------------------------------------------------------*/
- /* Set the status */
- /*-------------------------------------------------------------------*/
-
- switch(CA.astatus)
- {
- case TPANOREQ:
- strcpy(buffer, "NOREQ");
- break;
-
- case TPAIMPLY:
- strcpy(buffer, "IMPLY");
- break;
-
- case TPAINVAL:
- strcpy(buffer, "INVAL");
- break;
-
- case TPAERROR:
- strcpy(buffer, "ERROR");
- break;
-
- case TPAOK:
- strcpy(buffer, "OK");
- break;
-
- default:
- strcpy(buffer, "?");
- break;
-
- }
-
- strcat(composite_temp, ".STATUS");
-
- rexx_set(composite_temp, buffer, strlen(buffer));
-
- composite_temp[composite_reset] = '\0';
-
- /*-------------------------------------------------------------------*/
- /* Set the DCNID */
- /*-------------------------------------------------------------------*/
-
- if (CA.atype == TPANOTE)
- {
- strcat(composite_temp, ".DCNID");
-
- rexx_set(composite_temp, CA.dcnid, CA.dcnidlen);
-
- composite_temp[composite_reset] = '\0';
- }
-
- } /*----- End attribute loop ------------------------------------------*/
-
- /*-----------------------------------------------------------------------*/
- /* set the attribute list */
- /*-----------------------------------------------------------------------*/
-
- composite_temp[end_root] = '\0';
-
- strcat(composite_temp, "ALIST");
-
- i = strlen(alist);
- if (i > 0)
- --i;
-
- rexx_set(composite_temp, alist, i);
-
- }
-
- /*****************************************************************************/
- /* Set a rexx variable */
- /* Drop a rexx variable */
- /* */
- /* Author: Roy Engehausen */
- /* Mods: Jack Steitz 1. Bring code to ANSI Standard */
- /* */
- /* */
- /*****************************************************************************/
-
- /*===========================================================================*/
- /* External files */
- /*===========================================================================*/
-
- #include <dos.h>
- #pragma option -a- /* Borland C: force byte alignment */
- #include "rexxcall.h"
- #pragma option -a. /* Borland C: restore previous alignment */
-
- #ifdef __SMALL__ /* small model */
- #define FINDINT findints
- #endif
- #ifdef __MEDIUM__ /* medium model */
- #define FINDINT findintm
- #endif
- #ifdef __LARGE__ /* large model */
- #define FINDINT findintl
- #endif
-
- int FINDINT(int *);
-
- void error_rexx(char *);
-
- /*===========================================================================*/
- /* REXX_SET */
- /*===========================================================================*/
-
- void rexx_set(char * var_name,
- char * var_value,
- int var_length)
-
- {
-
- /*-----------------------------------------------------------------------*/
- /* Local Variables */
- /*-----------------------------------------------------------------------*/
-
- struct shvblock sb, *sbp = &sb;
- union REGS inregs, outregs;
- struct SREGS segregs;
- int interrupt_status;
- int rexx_interrupt;
-
- rexx_interrupt = FINDINT(&interrupt_status);
- if (interrupt_status != 0) error_rexx("RXINTMGR not installed.\n");
-
- inregs.h.ah = REXX_VERSION;
- inregs.h.al = 0;
- int86(rexx_interrupt, &inregs, &outregs);
- if (outregs.h.al == 0) error_rexx("REXX not loaded\n");
-
- segread(&segregs);
-
- /*-----------------------------------------------------------------------*/
- /* Initialize block */
- /*-----------------------------------------------------------------------*/
-
- memset(&sb, 0, sizeof(struct shvblock));
-
- sb.shvcode = SHVSET;
-
- sb.shvnext_addr = 0;
-
- sb.shvnam_addr = var_name;
- sb.shvnaml = strlen(var_name);
-
- sb.shvvall = var_length;
- sb.shvbufl = var_length;
-
- sb.shvval_addr = var_value;
-
- inregs.h.ah = REXX_SHV;
- #ifdef __LARGE__ /* predefined by Borland c if large model */
- inregs.x.bx = FP_SEG(sbp);
- inregs.x.dx = FP_OFF(sbp);
- #else /* medium or small model */
- inregs.x.bx = segregs.ds;
- inregs.x.dx = (unsigned) sbp;
- #endif
- int86x(rexx_interrupt, &inregs, &outregs, &segregs);
-
- }
-
- /*===========================================================================*/
- /* REXX_DROP */
- /*===========================================================================*/
-
- void rexx_drop(char * var_name)
-
- {
-
- /*-----------------------------------------------------------------------*/
- /* Local Variables */
- /*-----------------------------------------------------------------------*/
-
- struct shvblock sb, *sbp = &sb;
- union REGS inregs, outregs;
- struct SREGS segregs;
- int interrupt_status;
- int rexx_interrupt;
-
- rexx_interrupt = FINDINT(&interrupt_status);
- if (interrupt_status != 0) error_rexx("RXINTMGR not installed.\n");
-
- inregs.h.ah = REXX_VERSION;
- inregs.h.al = 0;
- int86(rexx_interrupt, &inregs, &outregs);
- if (outregs.h.al == 0) error_rexx("REXX not loaded\n");
-
- segread(&segregs);
-
- /*-----------------------------------------------------------------------*/
- /* Initialize block */
- /*-----------------------------------------------------------------------*/
-
- memset(&sb, 0, sizeof(struct shvblock));
-
- sb.shvcode = SHVDROPV;
-
- sb.shvnext_addr = 0;
-
- sb.shvnam_addr = var_name;
- sb.shvnaml = strlen(var_name);
-
- inregs.h.ah = REXX_SHV;
- #ifdef __LARGE__ /* predefined by Borland C if large model */
- inregs.x.bx = FP_SEG(sbp);
- inregs.x.dx = FP_OFF(sbp);
- #else /* medium or small model */
- inregs.x.bx = segregs.ds;
- inregs.x.dx = (unsigned) sbp;
- #endif
- int86x(rexx_interrupt, &inregs, &outregs, &segregs);
-
- }
-
- /* Display error message and exit (similar to CI 86 abort() function) */
- void error_rexx(char *s)
- {
- printf("ABORT:- %s\n",s);
- exit(255);
- }
- /******************************************************************************/
- #include "sgmlsubs.c" /* Subroutines for SGML API. */
- /******************************************************************************/